@extends('layouts.admin')
@section('css')
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_page.css') }}" rel="stylesheet" />
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_table.css') }}" rel="stylesheet">
@endsection
@section('content')
<section id="main-content">
          <section class="wrapper">
              <!-- page start-->
              <div class="row">
                  <!-- <div class="col-sm-12">
                      <section class="panel">
                          
                          <div class="panel-body">
                                   
                          </div>
                      </section>
                  </div> -->
                  <div class="col-lg-12">
                      <section class="panel">
                        <div class="panel-body">
                            <div class="btn-group mr10 pull-right">
                                <a href="{{ route('admin.statistics.groups.create') }}" class="btn btn-white tooltips"
                                   data-toggle="tooltip" data-original-title="新增"><i
                                            class="glyphicon glyphicon-plus"></i></a>
                               
                            
                        </div><!-- pull-right -->
                       
                          <header class="panel-heading">
                              经纪人组管理中心
                          </header>
                          <div class="panel-body">
                                <div class="adv-table">
                                    <table  class="display table table-bordered table-striped" id="reply">
                                      <thead>
                                      <tr>                                                                                   
                                          <th>名称</th>                                          
                                          <th class="hidden-phone">操作</th>
                                      </tr>
                                      </thead>
                                      <tbody>
                                      @foreach($groups as $group)
                                      <tr class="gradeX">
                                                                                   
                                          <td>{{ $group->name }}</td>                                        
                                          <td class="center hidden-phone">
                                            <a href="{{ route('admin.statistics.groups.edit',['id'=>$group->id]) }}"
                                               class="btn btn-primary btn-xs"><i class="icon-pencil"></i> </a>
                                            <a href="{{ route('admin.statistics.groups.agents',['id'=>$group->id]) }}"
                                               class="btn btn-primary btn-xs"><i class="icon-user"></i> </a>
                                            <a class="btn btn-danger btn-xs user-delete"
                                               data-href="{{ route('admin.statistics.groups.destroy',['id'=>$group->id]) }}">
                                                <i class="icon-trash"></i> </a>
                                          </td>
                                      </tr>
                                      @endforeach
                                      
                                
                                      <tfoot>
                                      
                                      </tfoot>
                          </table>
                                </div>
                          </div>
                          </div>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
@endsection
@section('javascript')
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
 <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
          $('#reply').dataTable( {
              "aaSorting": [[ 4, "desc" ]],
              "oLanguage": {
                   "oPaginate": {
                     "sLast": "最后一页",
                     "sNext":"下页",
                     "sPrevious":"上页",
                     "sEmptyTable":"表里没有数据",
                   },
                   "sInfo": " _START_ - _END_ / _TOTAL_ 条记录",
                   "sLengthMenu": "显示 _MENU_ 条记录",
                   "sSearch": "搜索:",
                 }
          } );
      } );


        $(".user-delete").click(function () {
            Rbac.ajax.delete({
                type:'delete',
                data:{"_token" : "{{ csrf_token() }}" },
                confirmTitle: '确定删除该组吗?',
                href: $(this).data('href'),
                successTitle: '删除成功'
            });
        });

        $(".deleteall").click(function () {
            Rbac.ajax.deleteAll({
                confirmTitle: '确定删除选中的期权?',
                href: $(this).data('href'),
                successTitle: '删除成功'
            });
        });
    
      
  </script>  
@endsection

